package com.okay.at

import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.okay.testclass.R
import com.okay.testclass.databinding.ActivityAtBinding

class AtActivity :FragmentActivity(){

    private lateinit var binding: ActivityAtBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityAtBinding.inflate(layoutInflater)
        setContentView(binding.root)

       binding.atAdd.setOnClickListener{
           val spannableString = CheckAtUtil().conversionDraw(this, getString(R.string.nbsp, "@王老七"),20f)
           //双屏设备就在当前文本框显示
           val index: Int =  binding.atEdit.selectionStart //获取光标所在位置
           binding.atEdit.editableText.insert(index, spannableString)
       }
    }
}